<?php
// 解决跨域问题
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
$allow_origin = array(
    'https://m.99496.com',
    'https://www.99496.com',
    'https://api.99496.com',
    'https://dev.99496.com',
    'https://www.dddm.tv',
    'https://api.dddm.tv',
    'https://www.5ddm.com',
    'https://www.kanfan.net',
    'http://dd.99496.com',
    'http://kf.99496.com',
    'http://5.99496.com',
    'http://localhost:4000',
    'http://localhost:4001',
    'http://localhost:8080',
    'http://localhost:8081',
    'http://localhost:10086',
    'http://127.0.0.1:10086'
);
header('Content-Type:text/html;charset=utf-8');
if (in_array($origin, $allow_origin)) {
    header('Access-Control-Allow-Origin:' . $origin);
}
header("Access-Control-Allow-Methods:GET, POST, PATCH, PUT, DELETE");
header('Access-Control-Allow-Headers:Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');

error_reporting(E_ERROR | E_WARNING | E_PARSE);
error_reporting(0);
header('Content-Type:text/html;charset=utf-8');
// 检测PHP环境
if(version_compare(PHP_VERSION,'5.5.0','<'))  die('PHP版本过低，最少需要PHP5.5，请升级PHP版本！');
//超时时间
@ini_set('max_execution_time', '0');
//内存限制 取消内存限制
@ini_set("memory_limit",'-1');

define('APP_PATH', __DIR__ . '/../lib/');
// 定义入口文件目录
define('BASE_PATH',__DIR__ .'/');
// 定义文件所在目录
define('URL_PATH',str_replace(array('\\','//'),'/',dirname($_SERVER['SCRIPT_NAME']).'/'));
//定义对外资源文件目录
define('TPL_PATH',URL_PATH);
define('ENTRANCE', 'index');
// 定义入口
$pathinfo= pathinfo($_SERVER['SCRIPT_NAME']);
$basename=$pathinfo['basename'];
if(substr($basename,strlen($basename)-4)!=='.php'){
    $basename = substr($basename,0,strpos($basename,'.php')) .'.php';
}
define('PATH_FILE',$basename);
if(!is_file('../runtime/install/install.lock')) {
    header("Location: ".URL_PATH."install.php");
    exit;
}
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';

?>